import apis from '@/apis'

export default {
  namespaced: true,
	state: {
		storeDateList: [],
		sfDateList: [],
		storeVisitDateList: [],
		sxxVisitDateList: [],
	},
	mutations: {
		setData (state, { key, value }) {
			state[key] = value
		}
	},
	actions: {
		/*
		 * 服务时间
		 * 包含顺丰上门、小站上门、到店、闪修侠上门
		*/
		async getServiceTime ({ commit }) {
			const [res] = await apis.getServiceTime()
			if (res._errCode === '0') {
				const { xz = [], sf = [], sxx = [] } = res._data || {}
				commit('setData', { key: 'sfDateList', value: sf })
				commit('setData', { key: 'storeDateList', value: xz })
				commit('setData', { key: 'storeVisitDateList', value: xz })
				commit('setData', { key: 'sxxVisitDateList', value: sxx })
			}
		}
	}
}